<?php
	/** echo $this->HTML->css('loginV2'); */
	/** echo $this->HTML->css('bootstrap'); */
	echo $this->HTML->css('usersIndex');
?>

<div class="paperfiles view">
<h2><?php  echo __('File '.h($paperfile['Paperfile']['file_code'])); 
$loggedUser = $this->Session->read('Auth.User');?></h2>
	<dl>
		<dt><?php echo __('File Code'); ?></dt>
		<dd>
			<?php echo h($paperfile['Paperfile']['file_code']); ?>
			&nbsp;
		</dd>
		<dt><?php echo __('Title'); ?></dt>
		<dd>
			<?php echo h($paperfile['Paperfile']['file_title']); ?>
			&nbsp;
		</dd>
		<dt><?php echo __('Description'); ?></dt>
		<dd>
			<?php echo h($paperfile['Paperfile']['file_desc']); ?>
			&nbsp;
		</dd>
		<?php
		if($paperfile['Paperfile']['user_id'] != NULL)
		{
			?>
			<dt><?php echo __('User'); ?></dt>
			<dd>
				<?php echo $this->Html->link($paperfile['User']['title'], array('controller' => 'users', 'action' => 'view', $paperfile['User']['id'])); ?>
				&nbsp;
			</dd>
		<?php
		}
		else
		{
			echo $this->Form->create('Paperfile');
			echo $this->Form->hidden('id', array('default' => h($paperfile['Paperfile']['id'])));
			echo $this->Form->hidden('user_id', array('default' => $loggedUser['id']));
			echo $this->Form->end(__('Borrow'));
		}
		if($paperfile['Paperfile']['user_id'] != NULL && $paperfile['Paperfile']['user_id'] == $loggedUser['id'])
		{
			echo $this->Form->create('Paperfile');
			echo $this->Form->hidden('id', array('default' => h($paperfile['Paperfile']['id'])));
			echo $this->Form->hidden('user_id', array('default' => NULL));
			echo $this->Form->end(__('Return'));
		}
		
		?>
	</dl>
</div>
<div class="actions">
	<h3><?php echo __('Actions'); ?></h3>
	<ul>
		<li><?php echo $this->Html->link(__('Edit File'), array('action' => 'edit', $paperfile['Paperfile']['id'])); ?> </li>
		<li><?php echo $this->Form->postLink(__('Delete File'), array('action' => 'delete', $paperfile['Paperfile']['id']), null, __('Are you sure you want to delete # %s?', $paperfile['Paperfile']['id'])); ?> </li>
		<li><?php echo $this->Html->link(__('List Files'), array('action' => 'index')); ?> </li>
		<li><?php echo $this->Html->link(__('New File'), array('action' => 'add')); ?> </li>
</ul>
</div>
